{include file="header"}
<div style="padding: 20px;">
<form class="layui-form" action="">
  <div class="layui-form-item layui-form-text">
      <textarea name="sql" lay-verify="required" placeholder="SQL语句" class="layui-textarea" style="height: 400px;"></textarea>
      <button class="layui-btn" lay-submit lay-filter="set-add" style="margin-top:10px;">立即执行</button>
    </div>
  </div>
</form>
<div class="layui-card">
  <div class="layui-card-header">温馨提示</div>
  <div class="layui-card-body">
    如果你不懂SQL语句请勿随便执行 自己执行发生的错误 请为自己买单
  </div>
</div>

<script>
layui.use('form',function(){
  var form = layui.form
  ,jq = layui.jquery;
  //添加
  form.on('submit(set-add)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
    jq.post('{:url("set/sqlzx")}',param,function(data){
      if(data.code == 1){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
          location.reload();
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
    return false;
  });
})
layui.use('laydate', function(){
  var laydate = layui.laydate;
  laydate.render({
    elem: '#time'
  });
});
</script>
</div>  
{include file="footer"}